package main

import "fmt"

func main03() {
	// 先申明，不占内存
	var a map[string]string
	// 使用前必须用make分配空间
	a = make(map[string]string, 10)
	a["no1"] = "no1"
	a["no2"] = "no2"
	a["no1"] = "no3"
	fmt.Println(a)

	// 声明时直接赋值
	a2 := map[string]string{
		"no1": "no1",
		"no2": "no2",
		"no3": "no3",
	}
	fmt.Println(a2)

	delete(a2, "no1")
	fmt.Println(a2)

	for key, value := range a2 {
		fmt.Println("key=", key+";value="+value)
	}

	fmt.Println(len(a2))
}
